/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javamail.speech.util;

/**
 *
 * @author sriram
 */
public enum eSpeechStatusType {
    UNINIT("uninit", 0),
    STARTED("started",1),
    STOPPED("stopped",2),
    CLOSED("closed",3);

    private final String name;
    private final int index;
    
    eSpeechStatusType(String name, int index) {
        this.name = name;
        this.index = index;
    }
    
    public String toName() {
        return name;
    }
 
    public int toIndex() {
        return index;
    }

    public eSpeechStatusType getFromName(String name) {
        name = name.trim().toLowerCase();
        for(eSpeechStatusType sp: eSpeechStatusType.values()) {
            if(sp.name.equalsIgnoreCase(name))
                return sp;
        }
        return UNINIT;
    }
}
